﻿<UserControl x:Class="GBlason.Control.Aggregate.TreeView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Properties="clr-namespace:GBlason.Properties" xmlns:ViewModel="clr-namespace:GBlason.ViewModel"
             xmlns:Contract="clr-namespace:GBlason.ViewModel.Contract"
             xmlns:General="clr-namespace:GBlason.ViewModel.General" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary Source="..\..\Dictionary\TreeViewTemplateDictionary.xaml"/>
    </UserControl.Resources>
    <Grid>
        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MinHeight="20" MaxHeight="80"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0"
                Background="{StaticResource ResourceKey=UserControlHeaderBackgroundBrush}"
                CornerRadius="0"
                Margin="0"
                BorderThickness="1,1,1,0"
                BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}">
            <Border Grid.Row="0"
                Margin="0"
                BorderThickness="1,1,1,0"
                BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}">
                <DockPanel>
                    <DockPanel DockPanel.Dock="Bottom">
                        <Button DockPanel.Dock="Left" Width="22" Height="22" Margin="2,0"
                            Style="{StaticResource ResourceKey=MenuRecentFileButtonStyle}"
                                x:Name="UnselectAllButton">
                            <Image Source="..\..\Pictures\Icons16\construction.png" Height="16" Width="16"/>
                        </Button>
                        <Button DockPanel.Dock="Left" Width="22" Height="22" Margin="2,0"
                            Style="{StaticResource ResourceKey=MenuRecentFileButtonStyle}" x:Name="DeleteNodeButton">
                            <Image Source="..\..\Pictures\Icons16\cross.png" Height="16" Width="16"/>
                        </Button>

                        <TextBox x:Name="SearchPropertiesTextBox"
                                 Margin="2" Height="22"
                                 Width="160"
                                 DockPanel.Dock="Right"></TextBox>
                        <Image Source="..\..\Pictures\Icons16\find.png" Height="16" Width="16"
                               Margin="8,0,2,0" DockPanel.Dock="Right"
                               VerticalAlignment="Center"/>
                        <Border/>
                    </DockPanel>
                    <DockPanel Margin="0,5,0,5">
                        <TextBlock Text="{x:Static Properties:Resources.ControlTreeViewTitle}"
                       VerticalAlignment="Center" HorizontalAlignment="Left"
                       Margin="10,0,2,0"/>
                    </DockPanel>

                </DockPanel>
            </Border>
        </Border>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="6"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="6"/>
            </Grid.ColumnDefinitions>
            <Border Grid.Column="0"
                    Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}"
                    BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                    BorderThickness="1,0,0,1">
                <Border x:Name="InnerBorderBottomLeft"
                        BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}"
                        BorderThickness="1,0,0,1"
                        Margin="0,0,0,1"/>
            </Border>
            <Border Grid.Column="2"
                    Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}"
                    BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                    BorderThickness="0,0,1,1">
                <Border x:Name="InnerBorderBottomRight"
                        BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}"
                        Margin="1,0,0,0"
                        BorderThickness="0,0,1,1"/>
            </Border>
            <Border Grid.Column="1" Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}">
                <Border x:Name="FieldContainerLightBorder"
                        Margin="-2,0,-2,1"
                        CornerRadius="2,2,0,0"
                        BorderThickness="1,1,1,0"
                         BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}">
                    <Border x:Name="FieldContainerDarkBorder"
                        Margin="0"
                        CornerRadius="2,2,0,0"
                        BorderThickness="1,1,1,0"
                         BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"/>
                </Border>
            </Border>
            <Border x:Name="ContentBackground"
                    Grid.Column="1"
                    Margin="0,2,0,0"
                    CornerRadius="2,2,0,0"
                    Background="#AAFFFFFF"
                    BorderThickness="0,0,0,1"
                    BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}">
                <ScrollViewer VerticalScrollBarVisibility="Auto"
                              HorizontalScrollBarVisibility="Disabled"
                              HorizontalAlignment="Stretch">
                    <TreeView Background="Transparent"
                              x:Name="PropertiesTreeview"
                              BorderThickness="0"
                              BorderBrush="Transparent"
                              ItemsSource="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}, Path=CurrentlyDisplayedFile.RootForTreeView}"
                              SelectedValuePath="{Binding Source={x:Static General:GlobalApplicationViewModel.GetApplicationViewModel}, Path=CurrentlyDisplayedFile.CurrentlySelectedComponent}"
                              SelectedItemChanged="TreeViewSelectedItemChanged">
                        <TreeView.ItemTemplate>
                            <HierarchicalDataTemplate ItemsSource="{Binding Children}" DataType="{x:Type Contract:CoatOfArmComponent}">
                                <DockPanel>
                                    <TextBlock Text="{Binding ComponentName}" />
                                </DockPanel>
                            </HierarchicalDataTemplate>
                        </TreeView.ItemTemplate>
                    </TreeView>
                </ScrollViewer>
            </Border>
            <Border x:Name="DropShadowContent"
                    Height="4" VerticalAlignment="Top"
                    Margin="0,2"
                    CornerRadius="2,2,0,0"
                    Background="{StaticResource ResourceKey=UserControlHeaderDropingShadow}"
                    Grid.Column="1">
            </Border>
        </Grid>
    </Grid>
</UserControl>
